package fons.model.ontology;

import java.util.Set;

import fons.model.ontology.interfaces.Definable;

@Definable
public abstract class AbstractViewDefinition {
	private final Context context;
	private ViewModel view;
	private String viewName; 

	protected AbstractViewDefinition (final Context context) {
		this.context = context;
		this.view = new ViewModel(this.context);
	}	

	public AbstractViewDefinition with (final String name, final DimensionCollection dimensions) {
		view.setDimensions(name, dimensions);
		return this;
	}

	public AbstractViewDefinition with (final String name, final Set<Dimension> dimensions) {
		view.setDimensions(name, dimensions);
		return this;
	}
	
	public AbstractViewDefinition named (final String viewName) {
		this.viewName = viewName;
		return this;
	}

	public final String getName() {
		return this.viewName;
	}

	public final Context getContext() {
		return this.context;
	}

	public final ViewModel getViewModel() {
		return this.view;
	}
	
	public abstract AbstractViewDefinition as (String viewType);
}
